﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace Fjaspx.Templet
{
    /// <summary>
    /// 
    /// </summary>
    public class ObjetForm
    {
        /// <summary>
        /// Replaces the form date.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <returns></returns>
        public static string ReplaceFormDate(string content, int ID, string ClassKind)
        {

            Regex r = new Regex(@"\{\$(?<Name>\w+)\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
            foreach (Match m in r.Matches(content))
            {
                string Name = m.Groups["Name"].ToString();
                content = content.Replace("{$" + Name + "}", Fjaspx.Templet.Xml.GetValue(ID, ClassKind, Name));
            }
            return content;
        }

    }
}
